﻿<phone:PhoneApplicationPage 
    x:Class="RssReaderTemplate.Views.Categories"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="696"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="True">
    <phone:PhoneApplicationPage.Resources>
        <DataTemplate x:Key="PivotItemTemplate">
            <controls:PivotItem>
                <ListBox x:Name="Items" HorizontalAlignment="Left" Width="456" 
                     ItemsSource="{Binding Elements}" 
                     ItemTemplate="{StaticResource FeedItemTemplate}"
                     SelectionChanged="Categories_SelectionChanged"
                     SelectedIndex="{Binding SelectedItemIndex, Mode=TwoWay}"
                     />
            </controls:PivotItem>
        </DataTemplate>
        <DataTemplate x:Key="PivotHeaderTemplate">
            <Grid>
                <TextBlock TextWrapping="Wrap"
                                   Text="{Binding Name}"
                                   d:LayoutOverrides="Width, Height" />
            </Grid>
        </DataTemplate>
    </phone:PhoneApplicationPage.Resources>
    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <!--Pivot Control-->
        <controls:Pivot x:Name="CategoryPivot" Title="$TemplateApplicationName$" ItemsSource="{Binding Categories}" ItemTemplate="{StaticResource PivotItemTemplate}"
                        HeaderTemplate="{StaticResource PivotHeaderTemplate}"
                        SelectedIndex="{Binding CurrentCategory, Mode=TwoWay}">
        </controls:Pivot>
    </Grid>

    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="False">
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
    
</phone:PhoneApplicationPage>